<?php

class Edm_Controller_Action extends Zend_Controller_Action {
    /* 数据库db连接资源 */

    public $db;
    /* 公用方法调用属性 */
    public $common;
    /* 分页属性 */
    public $pager;
    /* 后台管理员操作属性 */
    protected $_admin;
    /* 前台用户操作 */
    protected $_users;
    /* 文章分类 */
    protected $_articlecat;
    /* 文章 */
    protected $_article;

    public function init() {
        $this->db = Zend_Registry::get('db');
        $this->_admin = new Edm_Db_Admin();
        $this->_article = new Edm_Db_Article();
        $this->_articlecat = new Edm_Db_ArticleCat();
        $this->_users = new Edm_Db_Users();
        $this->common = new Edm_Common();
        $this->pager = new Edm_Pager();
        parent::init();
    }

    public function preDispatch() {
        $flag = false;
        $auth = Zend_Auth::getInstance();
        $identity = $auth->getIdentity();
        //print_r($identity);

        if ($auth->hasIdentity()) {

            /* front */
            //if (isset($identity->user_id)) {
            $this->view->identity = $identity;
            $flag = true;
            //}
        }
        $this->view->authenticated = $flag;
    }

}